package com.lp.bootstrap.system.controller;

import com.lp.bootstrap.system.bean.Menu;
import com.lp.bootstrap.system.service.IMenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

@Controller
public class Indexcontroller {


    @Autowired
    private IMenuService menuService;

    // 系统首页
    @GetMapping("/index")
    public String index(ModelMap mmap) {
        // 取身份信息

        // 根据用户id取出菜单
        List<Menu> menus = menuService.selectMenuAll();
        mmap.put("menus", menus);


       /* Dept dept = user.getDept();
        if(dept.getDeptId() == 0){
            dept.setDeptName("顶级分组");
            user.setDept(dept);
        }*/
       // boolean permittedOverView = ShiroUtils.getSubjct().isPermitted("index:overview:view");
        //mmap.put("overView", permittedOverView);
       //mmap.put("user", user);
        //mmap.put("copyrightYear", ruoYiConfig.getCopyrightYear());
        return "index";
    }



    // 系统首页
    @GetMapping("/main")
    public String main(ModelMap mmap) {
        // 取身份信息

       /* Dept dept = user.getDept();
        if(dept.getDeptId() == 0){
            dept.setDeptName("顶级分组");
            user.setDept(dept);
        }*/
        // boolean permittedOverView = ShiroUtils.getSubjct().isPermitted("index:overview:view");
        //mmap.put("overView", permittedOverView);
        //mmap.put("user", user);
        //mmap.put("copyrightYear", ruoYiConfig.getCopyrightYear());
        return "main";
    }


    // 系统首页
    @GetMapping("/vem/vemDevice")
    public String vemDevice(ModelMap mmap) {
        // 取身份信息

       /* Dept dept = user.getDept();
        if(dept.getDeptId() == 0){
            dept.setDeptName("顶级分组");
            user.setDept(dept);
        }*/
        // boolean permittedOverView = ShiroUtils.getSubjct().isPermitted("index:overview:view");
        //mmap.put("overView", permittedOverView);
        //mmap.put("user", user);
        //mmap.put("copyrightYear", ruoYiConfig.getCopyrightYear());
        return "login";
    }
}
